package com.frame.pageform.tag;

import com.frame.util.DataConvert;

public class RadioTag extends BaseHandlerTag{

	private String bind;
	private String text;
	private String value;
	private String name;

	public int start() throws Exception
	{
		String namecode=(name==null?bind:name);
		String s="<label class=\"radioButton\"><input name=\""+namecode+"\" type=\"radio\" value=\""+value+"\"";
		Object obj=executeExpression(bind);
		String objvalue=DataConvert.toString(obj);
		if(objvalue!=null && objvalue.equals(value))
			s+=" checked";
		s+="/>";
		s+=text+"</label>";
		write(s);
		return 0;
	}

	public String getBind() {
		return bind;
	}

	public void setBind(String bind) {
		this.bind = bind;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
